//跨组件通信演示 - 控制内容
import React, { useContext } from "react";
import { AppContext } from "./appContext";
const App: React.FC = () => {
  //拿到需要的状态和方法
  const { isActive, toggleStyle } = useContext(AppContext);

  return (
    <button onClick={toggleStyle}>
      背景色改为{isActive ? "灰色" : "蓝色"}
    </button>
  );
};

export default App;
